﻿using UnityEditor;

namespace GameBoxTools
{
    //对应组件上的右键菜单添加功能
    //ref: https://blog.csdn.net/wpapa/article/details/51066397
    public static class GameBoxMenu
    {
        /// <summary>
        /// 导出所有ParticleSystem信息，用于批量粒子分析
        /// </summary>
        [MenuItem("Overdraw/ExportParticleSystemInfo")]
        static void ExportAllParticleSystemPrefab()
        {
            var data = PrefabCheckTool.GetParticleSystem();
            Common.SaveToFile("allExportAllParticleSystemPrefabFiles", data);
        }

        /// <summary>
        /// 分析粒子overdraw
        /// </summary>
        [MenuItem("Assets/AnalyzeParticleSystemOverdraw")]
        static void AnalyzeParticleSystemOverdraw()
        {
            Common.AnalyzeParticleSystem(true);
        }

        /// <summary>
        /// 分析粒子透明像素占比
        /// </summary>
        [MenuItem("Assets/AnalyzeParticleSystemTransparent")]
        static void AnalyzeParticleSystemTransparent()
        {
            Common.AnalyzeParticleSystem(false);
        }
    }
}